package com.hspedu.writer_;

import java.io.*;
import java.nio.Buffer;

/**
 * @author DL5O
 * @version 1.0
 */
public class BufferedCopy_ {
    public static void main(String[] args) throws IOException {
        //D:\story.txt
        //说明：
        //1. BufferedReader和BufferedWriter是按照字符操作的
        //2. 不要去操作二进制文件[]，可能造成文件损坏
        String srcFilePath = "D:\\story.txt";
        String destFilePath = "D:\\story2.txt";//目的地的完整录取
        BufferedReader bufferedReader = new BufferedReader(new FileReader(srcFilePath));
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(destFilePath));
        String line;
        while( (line = bufferedReader.readLine()) != null){
            bufferedWriter.write(line);
            bufferedWriter.newLine();
        }
        System.out.println("拷贝完毕...");
        bufferedReader.close();
        bufferedWriter.close();
    }
}
